home *** CD-ROM | disk | FTP | other *** search
- /*
- File: WindowObj.h
-
- Contains: Windows for a simple Scriptable application.
-
- Developed by:
-
- Paul G Smith (commstalk hq & Full Moon Software, Inc)
-
- you can leave messages at (UK): 0727 844232; (US): 408 253 7199
- BUT I prefer to be contacted by e-mail
- AppleLink: SMITH.PG
- Internet: SMITH.PG@applelink.apple.com
-
- "SimpliFace" Sample code to accompany develop article
- on techniques for embedding scripts in applications.
-
- */
-
- #ifndef __WINDOWOBJ__
- #define __WINDOWOBJ__
-
- #ifndef __SCRIPTOBJECTS__
- #include "ScriptableObjects.h"
- #endif
-
- #ifndef __PASCALSTRING__
- #include "PascalString.h"
- #endif
-
- #ifndef __CONTROLS__
- #include "Controls.h"
- #endif
-
-
- /**********************************************************************
- ** class TWindowObj
- ***********************************************************************/
-
- class TWindowObj : public TScriptableObject {
- public:
- TWindowObj();
- TWindowObj(const AEDesc *theData);
- virtual ~TWindowObj();
-
- virtual void ActivateWindow(Boolean isActivating);
-
- virtual void UpdateWindow(void);
-
- virtual void DrawAllElements(DescType desiredClass);
-
- virtual void DrawWindow(void);
-
- virtual TScriptableObject* FindElement(Point& thePt, DescType desiredClass);
-
- virtual OSErr OpenObject (void);
-
- virtual OSErr CloseObject (void);
-
-
- virtual OSErr CountElements (DescType desiredClass,
- long *result);
-
- virtual OSErr ResolveContainer (TScriptableObject **theContainerObj);
-
- virtual OSErr ResolveElementByName(DescType desiredClass,
- CStr255& nameStr,
- TScriptableObject **theResultObj);
-
- virtual OSErr ResolveElementByIndex(DescType desiredClass,
- short theIndex,
- TScriptableObject **theResultObj);
-
- virtual OSErr GetProperty (DescType propertyID, DescType wantType, AEDesc *result);
-
- virtual OSErr SetProperty (DescType propertyID, const AEDesc *theData);
-
- virtual OSErr GetObjectSpecifier (AEDesc *result);
-
- virtual OSErr GetTargetObjectSpecifier (EventRecord& theEvent, AEDesc *result);
-
- virtual OSErr CreateNewElement (DescType desiredClass,
- DescType position,
- AEDesc *theData,
- AERecord *theProperties,
- TScriptableObject *theContainerObj,
- TScriptableObject **theNewObj);
-
- void GetName(CStr255& theName) { theName = fName; };
-
- WindowPtr GetWindowPtr(void) { return fWindowPtr; };
-
- private:
- void InitFields(void);
-
- protected:
- Boolean fInitialized;
- Rect fBounds;
- Boolean fHasCloseBox;
- Boolean fHasTitleBar;
- Boolean fIsModal;
- Boolean fIsResizable;
- Boolean fIsZoomable;
- Boolean fIsZoomed;
- CStr255 fName;
- Boolean fShouldBeVisible;
- Boolean fHasBeenCreated;
- short fWindowDefProc;
- WindowPtr fWindowPtr;
- TListOfLongs fButtonElems; // list of *TInterfaceObj
- TListOfLongs fFieldElems; // list of *TInterfaceObj
- };
-
-
- //
- // interface classes:
- //
- // TInterfaceObj (defines all common properties of descendants)
- // |
- // |
- // ______|______
- // | |
- // TButtonObj TLabelObj
- //
-
-
- /**********************************************************************
- ** class TInterfaceObj
- ***********************************************************************/
-
- class TInterfaceObj : public TScriptableObject {
- public:
- TInterfaceObj(TWindowObj* container);
- TInterfaceObj(TWindowObj* container,
- const AEDesc *theData);
- virtual ~TInterfaceObj();
-
- virtual void DrawObject (void);
-
- virtual void ForceRedrawObject (Boolean drawNow);
-
- virtual OSErr ResolveContainer (TScriptableObject **theContainerObj);
-
- virtual OSErr GetProperty (DescType propertyID, DescType wantType, AEDesc *result);
-
- virtual OSErr SetProperty (DescType propertyID, const AEDesc *theData);
-
-
- virtual OSErr GetObjectSpecifier (AEDesc *result);
-
- virtual DescType GetClass(void);
-
- void GetName(CStr255& theName) { theName = fName; };
-
- void GetBounds(Rect& theBounds) { theBounds = fBounds; };
-
- protected:
- virtual void InitFields(void);
-
- TWindowObj* fContainer;
- Boolean fInitialized;
- Rect fBounds;
- CStr255 fName;
- CStr255 fFontName;
- short fFontSize;
- short fFontStyle;
- RGBColor fFgColor;
- };
-
-
-
-
- /**********************************************************************
- ** class TButtonObj
- ***********************************************************************/
-
- class TButtonObj : public TInterfaceObj {
- public:
- TButtonObj(TWindowObj* container);
- TButtonObj(TWindowObj* container,
- const AEDesc *theData);
- virtual ~TButtonObj();
-
- virtual void DrawObject (void);
-
- virtual void ForceRedrawObject (Boolean drawNow);
-
- virtual OSErr GetProperty (DescType propertyID, DescType wantType, AEDesc *result);
-
- virtual OSErr SetProperty (DescType propertyID, const AEDesc *theData);
-
- virtual DescType GetClass(void);
-
- protected:
- virtual void InitFields(void);
-
- DescType fButtonKind;
- ControlHandle fControlH;
- };
-
-
-
- /**********************************************************************
- ** class TLabelObj
- ***********************************************************************/
-
- class TLabelObj : public TInterfaceObj {
- public:
- TLabelObj(TWindowObj* container);
- TLabelObj(TWindowObj* container,
- const AEDesc *theData);
- virtual ~TLabelObj();
-
- virtual void DrawObject (void);
-
- virtual void ForceRedrawObject (Boolean drawNow);
-
- virtual OSErr GetProperty (DescType propertyID, DescType wantType, AEDesc *result);
-
- virtual OSErr SetProperty (DescType propertyID, const AEDesc *theData);
-
- virtual DescType GetClass(void);
-
- protected:
- virtual void InitFields(void);
-
- Handle fContents; // contents of field, raw text
- };
-
-
-
-
- #endif
-